home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
090
/
pctj8402.arc
/
PWD.ASM
< prev
next >
Wrap
Assembly Source File
|
1983-10-09
|
1KB
|
64 lines
page 60,132
title PWD.ASM
; PWD -- Print Working Directory. This program prints the pathname
; of the current directory under PCDOS 2.0.
;
; Author: Bruce Kvam
;
; To assemble this program do:
;
; masm pwd;
; link pwd;
; exe2bin pwd.exe pwd.com
;
; The files pwd.obj and pwd.exe will be left around and should be erased.
; PWD.COM will contain this program.
dos macro function ;; Perform a DOS function call.
mov ah,function
int 21h
endm
putc macro char ;; Output a character to the console.
mov dl,char
dos 2
endm
code segment
assume cs:code, ds:code, es:code
org 100h
start:
; First get and print the current drive.
dos 19h ; get default drive code from DOS.
add al,'A'
putc al ; display drive code.
putc ':'
putc '\'
; Then get and print the current pathname.
mov dl,0 ; default drive
lea si,pathname
dos 47h ; request pathname from DOS.
printloop:
cmp byte ptr [si],0 ; pathname terminated by 0.
jz exit
putc [si]
inc si ; point to next character.
jmp printloop
exit:
int 20h ; Return to DOS.
; Storage area where DOS writes the current pathname (an ASCIIZ
; string).
pathname db 65 dup (?)
code ends
end start